// mytime0.cpp -- implementing Time methods
#include <iostream>
#include "mytime0.h"

Time::Time(int hours, int minutes)
{
    _hours = hours;
    _minutes = minutes;
}

void Time::AddHour(int hours)
{
    _hours += hours;
}

void Time::AddMin(int minutes)
{
    _minutes += minutes;
    _hours = _hours + _minutes / 60;
    _minutes %= 60;
}

void Time::Reset(int hours, int minutes)
{
    _hours = hours;
    _minutes = minutes;
}

Time Time::Sum(const Time & t) const
{
    Time sum;
    sum._minutes =  _minutes + t._minutes;
    sum._hours = _hours + t._hours + sum._minutes / 60;
    sum._minutes %= 60;

    return sum;
}

void Time::Show() const
{
    std::cout << _hours << " hours, " << _minutes << " minutes";
}
